package com.tianpengtech.common.util;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {


    public static String YYMM_FORMAT="yyyy-MM";
    public static String YYMMdd_FORMAT="yyyy-MM-dd";
    public static String MMdd_FORMAT="MM-dd";
    public static String YYMMDDHHMMSS_FORMAT="yyyy-MM-dd HH:mm:ss";
    public static String YYMM_SLASH_FORMAT="yyyy/MM";//生成形如『2017/07』这样的文件夹
    public static String formateData(Date date,String fomat){

        SimpleDateFormat formatter;
        formatter = new SimpleDateFormat(fomat);
        String dateStr = formatter.format(date);
        return dateStr;
    }
    
    
    public static Date string2Date(String data,String format){
    	SimpleDateFormat sdf = new SimpleDateFormat(format);
    	Date date=null;
		try {
			date = sdf.parse(data);
		} catch (ParseException e) {
			e.printStackTrace();
		}
    	return date;
    }
}
